<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>复习</title>
  </head>
  <body></body>
  <script>
    var lessons = `
    #1 js,200元 #
    #2 php,300元 #
    #9 houdunren.com # 后盾人
    #3 node.js,180元 #
  `;

  var reg = /\s*#\d+\s+[\w元,.]+\s+#\s+/g
  // console.log(lessons.match(reg))
  
  var reg = /\s*#\d+(.+)\s*#$/gm
  console.log(lessons.match(reg))
  console.log('-----------------------\n')
  
  var match = null, result = []
  while(match = reg.exec(lessons))   {
    var [name, price] = match[1].split(',')
    result.push({name, price})
  }
  console.log(JSON.stringify(result, null, 2))
  

  </script>
</html>
